#include "widget.h"
#include "ui_widget.h"

#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    ui->lineEdit_3->setEchoMode(QLineEdit::Password);
}

Widget::~Widget()
{
    delete ui;
}

//这个参数arg1，就是要输入的内容
void Widget::on_lineEdit_1_textEdited(const QString &arg1)
{
    (void)arg1;
    this->compareTwoLineEdit();
}


void Widget::on_lineEdit_2_textEdited(const QString &arg1)
{
    (void)arg1;
    this->compareTwoLineEdit();
}

void Widget::compareTwoLineEdit()
{
    if(ui->lineEdit_1->text() == ui->lineEdit_2->text())
    {
            qDebug() << "两次输入的完全一致！！！！";
            ui->label->setText("两次输入的完全一致！！！！");
    }
    else
    {
            qDebug() <<  "两次输入的不一致";
            ui->label->setText("两次输入的不一致");
    }
}





void Widget::on_checkBox_toggled(bool checked)
{
    if(checked)
    {
        ui->lineEdit_3->setEchoMode(QLineEdit::Normal);
    }
    else
    {
        ui->lineEdit_3->setEchoMode(QLineEdit::Password);
    }
}



